package com.jeeplus.modules.api.utils.alipay;

import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.domain.AlipayFundTransOrderQueryModel;
import com.alipay.api.request.AlipayFundTransOrderQueryRequest;
import com.alipay.api.response.AlipayFundTransOrderQueryResponse;

/**
 * alipay.fund.trans.order.query(查询转账订单接口)
 * 商户可通过该接口查询转账订单的状态、支付时间等相关信息，主要应用于B2C转账订单查询的场景
 * 普通单笔转账到支付宝用这个没意义，查不到转账金额。order_fee这个参数 是对银行卡才用到的，如果转到支付宝余额的话 是为0
 * @author wb-wly251833
 *
 */
public class alipayFundTransOrderQuery {
	
	public static void main(String[] args) throws AlipayApiException {
		AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, AlipayConfig.format, AlipayConfig.charset, AlipayConfig.alipay_public_key, AlipayConfig.sign_type);
		AlipayFundTransOrderQueryRequest request = new AlipayFundTransOrderQueryRequest();
		AlipayFundTransOrderQueryModel model = new AlipayFundTransOrderQueryModel();
		//	商户转账唯一订单号
//		model.setOutBizNo("2017081015423214234321");
		//支付宝转账单据号：和商户转账唯一订单号不能同时为空。二选一传入
	   	model.setOrderId("20170810110070001500580000006005");
		request.setBizModel(model);
		AlipayFundTransOrderQueryResponse response = alipayClient.execute(request);
		System.out.println(response.getBody());
		
		if(response.isSuccess()){
		System.out.println("调用成功");
		} else {
		System.out.println("调用失败");
		}
	}
}
